import actionsType from "./actionsType";
import { getBookList } from '../api'
const actions = {
  setBookList() {
    // 返回函数  异步action
    return async (dispatch) => {
      const resp = await getBookList()
      dispatch({ type: actionsType.SET_BOOK_LIST, payload: resp.data.data })
    }
  },
  switchChecked(payload) {
    return  { type: actionsType.SWITCH_CHECKED, payload }
  },
  addGroup(payload) {
    return  { type: actionsType.ADD_GROUP , payload }
  },
  setGroup(payload) {
    return  { type: actionsType.SET_GROUP , payload }

  }
}

export default actions